package org.example.design.visitor.user.impl;

import org.example.design.visitor.user.User;
import org.example.design.visitor.visitor.Visitor;

import java.math.BigDecimal;

/**
 * @Classname Teacher
 * @Description 老师类
 * @Date 2020/11/12 2:26 下午
 * @Created by xiangjd
 */
public class Teacher extends User {
    public Teacher(String name, String identity, String clazz) {
        super(name, identity, clazz);
    }

    @Override
    public void accept(Visitor visitor) {
       visitor.visist(this);
    }

    // 升本率
    public double entranceRatio() {
        return BigDecimal.valueOf(Math.random() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
    }
}
